﻿package view.containers 
{
	import flash.events.Event;
	import flash.filters.DropShadowFilter;
	import flash.text.AntiAliasType;
	import flash.text.GridFitType;
	import model.MainModel;
	import model.User;
	import view.components.BaseImage;
	
	/**
	 * ...
	 * @author Slavshik Alexander
	 */
	public class UserInfo extends UserInfoTemplate
	{
		private var _user:User = new User;
		private var ava:BaseImage = new BaseImage(50, 50, true);
		
		public function UserInfo() {
			caption.autoSize = "left";
			caption.gridFitType = GridFitType.PIXEL;
			caption.antiAliasType = AntiAliasType.ADVANCED
			id_txt.restrict = "0-9";
			ava.y = 5;
			addChild(ava);
			ava.filters = [new DropShadowFilter(1,90,0,1,2,2,1,3)];
			caption.x = 55;
		}
		public function get user():User { 
			return _user;
		}
		public function set user(value:User):void {
			if (_user.uid == value.uid) return;
			_user = value;
			caption.text = _user.name;
			ava.load(_user.ava);
			male_btn.visible = true;
			female_btn.visible = true;
			if (_user.sex == 1) male_btn.visible = false;
			else female_btn.visible = false;
		}
		
	}
	
}